<template>
  <div class="songList">
    <div>
      <!-- 返回 -->
      <div class="back">
        <van-icon name="arrow-left" @click="back" size="25" />
        <span v-show="!isShow">全部歌单</span>
      </div>
      <!-- 背景图片 -->
      <van-sticky offset-top="-150">
        <div class="bgcImg">
          <div class="bgc">
            <img
              src="https://p1.music.126.net/UDpjFEHmXInxGd_xMAI12w==/109951162811986419.jpg?param=600y600"
              alt=""
            />
          </div>
          <div class="img_box">
            <div class="img">
              <img
                src="https://p1.music.126.net/UDpjFEHmXInxGd_xMAI12w==/109951162811986419.jpg?param=600y600"
                alt=""
              />
              <span class="playCount">
                <span class="iconfont">&#xe628;</span>
                <span> 5.3亿</span>
              </span>
            </div>
            <div class="titel">
              <p class="van-ellipsis">南风知我意，吹梦到西洲。</p>
              <p class="van-ellipsis">
                <span>华语/欧美/民谣/古风/流行 </span>
              </p>

              <p class="van-ellipsis">自叹多情是足愁， 况当风月满庭秋。</p>
            </div>
          </div>
        </div>
      </van-sticky>
    </div>
    <van-tabs v-model="active" sticky offset-top="46" animated line-width="20">
      <van-tab title="全部"><MusicSongsList /></van-tab>
      <van-tab title="华语"><Chinese /></van-tab>
      <van-tab title="欧美"><Europe /></van-tab>
      <van-tab title="民谣"><ballad /></van-tab>
      <van-tab title="古风"><antiquities /></van-tab>
      <van-tab title="流行"><fashion /></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import MusicSongsList from "@/components/common/song/songs_List.vue";
import Chinese from "@/components/common/song/Chinese.vue";
import Europe from "@/components/common/song/Europe.vue";
import ballad from "@/components/common/song/ballad.vue";
import antiquities from "@/components/common/song/antiquities.vue";
import fashion from "@/components/common/song/fashion.vue";
export default {
  name: "VueMusicSongClass",
  components: {
    MusicSongsList,
    Chinese,
    Europe,
    ballad,
    antiquities,
    fashion,
  },
  data() {
    return {
      active: 0,
      playCount: 0,
      isShow: true,
    };
  },

  mounted() {
    window.addEventListener("scroll", this.handleScroll, true);
  },

  methods: {
    back() {
      this.$router.go("-1");
    },
    handleScroll() {
      if (window.pageYOffset >= 150) {
        this.isShow = false;
      } else {
        this.isShow = true;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.songList /deep/ .van-nav-bar__content {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  background-color: #fff;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  height: 2.875rem;
}
.back {
  z-index: 999;
  position: fixed;
  top: 0.3125rem;
  left: 0rem;
  height: 2.5rem;
  width: 100%;
  line-height: 2.5rem;
  display: flex;

  .van-icon {
    height: 2.5rem;
    width: 1.875rem;
    font-size: 1.5625rem;
    line-height: 2.5rem;
    color: #fff;
  }
  span:nth-child(2) {
    flex: 1;
    font-size: 0.875rem;
    color: #fff;
    font-weight: bold;
    padding-right: 1.875rem;
  }
}
// 背景图片
.bgcImg {
  position: relative;
  width: 100%;
  height: 12.5rem;
  overflow: hidden;

  .bgc {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(0.625rem);
    transform: scale(1.5);
  }
  img {
    width: 100%;
    height: 100%;
  }
  .img_box {
    position: relative;
    position: absolute;
    top: 50%;
    left: 1.875rem;
    transform: translate(0, -50%);
    display: flex;
    height: 6.25rem;
    .img {
      width: 6.25rem;
      height: 6.25rem;
      border-radius: 0.3125rem;
      overflow: hidden;
      margin-right: 0.625rem;
      .playCount {
        position: absolute;
        bottom: 0.1875rem;
        left: 0.3125rem;
        font-size: 0.75rem;
        color: #edeef0;
        text-align: left;
        .iconfont {
          font-size: 0.75rem;
        }
      }
    }
    .titel {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      max-width: 14.375rem;
      p {
        width: 100%;
      }

      p:nth-child(1) {
        font-size: 0.875rem;
        text-align: left;
        color: #fff;
      }
      p:nth-child(2) {
        font-size: 0.75rem;
        text-align: left;
        color: #fff;
      }

      p:nth-child(3),
      p:nth-child(4) {
        font-size: 0.75rem;
        text-align: left;
        color: #fff;
      }
    }
  }
}
</style>